﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Koopakiller.Numerics.Addins;

namespace Koopakiller.Numerics.StandardAddins.FormulaParser
{
    /// <summary>
    /// Berechnet den Sinus.
    /// </summary>
    public sealed class Sin : IFunctionObject
    {
        #region IFunctionObject Members

        double IFunctionObject.Calculate(params double[] parameters)
        {
            if (parameters.Length != 1)
                throw new ArgumentException();
            return Math.Sin(parameters[0]);
        }

        int IFunctionObject.ParameterCount
        {
            get
            {
                return 1;
            }
        }

        string IFunctionObject.FunctionName
        {
            get
            {
                return "sin";
            }
        }

        #endregion
    }
    /// <summary>
    /// Berechnet den Kosinus.
    /// </summary>
    public sealed class Cos : IFunctionObject
    {
        #region IFunctionObject Members

        double IFunctionObject.Calculate(params double[] parameters)
        {
            if (parameters.Length != 1)
                throw new ArgumentException();
            return Math.Cos(parameters[0]);
        }

        int IFunctionObject.ParameterCount
        {
            get
            {
                return 1;
            }
        }

        string IFunctionObject.FunctionName
        {
            get
            {
                return "cos";
            }
        }

        #endregion
    }
    /// <summary>
    /// Berechnet den Tangens.
    /// </summary>
    public sealed class Tan : IFunctionObject
    {
        #region IFunctionObject Members

        double IFunctionObject.Calculate(params double[] parameters)
        {
            if (parameters.Length != 1)
                throw new ArgumentException();
            return Math.Tan(parameters[0]);
        }

        int IFunctionObject.ParameterCount
        {
            get
            {
                return 1;
            }
        }

        string IFunctionObject.FunctionName
        {
            get
            {
                return "tan";
            }
        }

        #endregion
    }
}
